home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / raytrace / radiance / simplerd.lha / simplerad / FinalFTP / WalkT / walk.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-20  |  7.9 KB  |  179 lines

  1. /**********************************************************************/
  2. /*                                                                    */
  3. /* walk.h : walk-through program primitives                           */
  4. /*                                                                    */
  5. /* Copyright (C) 1992, Bernard Kwok                                   */
  6. /* All rights reserved.                                               */
  7. /* Revision 1.0                                                       */
  8. /* May, 1992                                                          */
  9. /**********************************************************************/
  10. #ifndef WALK_H
  11. #define WALK_H
  12.  
  13. /**********************************************************************/
  14. /* Constants                                                          */
  15. /**********************************************************************/
  16. #ifndef TRUE 
  17. #define TRUE 1
  18. #endif /* TRUE */
  19. #ifndef FALSE
  20. #define FALSE 0
  21. #endif /* FALSE */
  22.  
  23. #define LARGEZ 10000.0
  24. #define ANGLE_SHOCK_ABSORBER 0.4   /* Scale rotational movements     */
  25. #define COORD_SHOCK_ABSORBER 0.04  /* Scale translational movements  */
  26.  
  27. /* Orientation Modal Flags */
  28. #define STILL -1        /* Not moving */
  29. #define ORIENT_ROT 0    /* Changing orientation (rotation in X,Y)     */
  30. #define ORIENT_SPIN 1   /* Changing orientation (rotation in Z)       */ 
  31. #define ORIENT_TRANSL 2 /* Changing orientation (translate in X,Y)    */
  32. #define ORIENT_ZOOM 3   /* Changing orientation (zoom=translate in Z) */
  33. #define ORIENT_SCALE 4  /* Changing orientation (zoom=translate in Z) */
  34. #define ORIENT_ABS 5    /* Changing orientation to absolute position  */
  35. #define PREORIENT 10    /* Reading orientation changes from file      */
  36.  
  37. /* Sessional Option Flags */
  38. #define NOLOG 0         /* Logging session                            */
  39. #define DOLOG 1         /* Not loggin session                         */
  40. #define DEBUG 1         /* Debugging messages on                      */
  41. #define NODEBUG 0       /* Debugging messages off                     */
  42. #define SHADE_TRIA 3    /* Shade patches using triangular mesh        */
  43. #define SHADE_QUAD 4    /* Shade patches using quadralateral mesh     */
  44. #define NO_SHADE 5      /* Draw mesh only                             */
  45.  
  46. /**********************************************************************/
  47. /* Option structures                                                  */
  48. /**********************************************************************/
  49. typedef struct { int x,y,z; } iVector;   /* integer vector            */
  50. typedef struct { float x,y,z; } fVector; /* float vector              */
  51.  
  52. typedef struct {
  53.   float scrnaspect;     /* aspect ratio value for window              */
  54.   long xscrnsize;       /* size of screen in x used to set aspect ratio */
  55.   long zfar;            /* maximum z in z-buffer                      */
  56.   int UsePrefsize;      /* Use preferred size of window               */
  57.   int UsePrefpos;       /* Use preferred position of window           */
  58.   int UseRGB;           /* Use RBG mode                               */
  59.   int UseDoubleBuf;     /* Use doublebuffering                        */
  60.   int UseZBuf;          /* Use Zbuffering                             */
  61.   int UseAccBuf;        /* Use Abuffering                             */
  62.   int UsePanel;         /* Use panels                                 */
  63.   int GraphInitialized; /* Graphics okay                              */
  64.   int UseVCR;           /* Record onto VCR                            */
  65.   int VCRmode;          /* VCR mode                                   */
  66.   int gamma;            /* Use gamma correction                       */
  67.   int FullScreen;       /* Display full screen. No border             */
  68. } SystemAttrib;
  69.  
  70. typedef struct {
  71.   int debug;            /* Debug ?                                    */
  72.   int mode;             /* Current state of movement                  */
  73.   int log;              /* Log current session camera movements       */
  74.   float ZoomFactor;     /* How much to scale for SCALEing             */
  75.   long shademodel;      /* Current shademodel (FLAT or GOURAUD or NO_SHADE) */
  76.   long shadeprim;       /* Shade TRIANGLES or QUADRALATERALS          */
  77.   int shadeBW;          /* Black and white outline                    */
  78.   char *data_dir;       /* Data directory (patches)                   */
  79.   int draw_axis;        /* Draw the xyz axis in scene                 */
  80.   float RGBscale;       /* Scale colours by this much                 */
  81. } OptionType;           /* User options                               */
  82.  
  83. /**********************************************************************/
  84. /* Structures for movement */
  85. /**********************************************************************/
  86. #define XDIR 'x'        /* X direction for h/w matrix rotations       */
  87. #define YDIR 'y'        /* Y direction for h/w matrix rotations       */
  88. #define ZDIR 'z'        /* Z direction for h/w matrix rotations       */
  89. #define X 0
  90. #define Y 1
  91. #define Z 2
  92.  
  93. /* Camera attributes */
  94. typedef struct {
  95.   Vector lookFrom;    /* Position looking from                      */
  96.   Vector lookAt;    /* Position looking at                        */
  97.   Vector lookUp;    /* Define up for camera                       */
  98.   int fovx, fovy;       /* Field of view in x,y                       */
  99.   double near, far;    /* Near and far clipping planes               */
  100.   int xRes, yRes;       /* Resolution of viewing plane                */
  101.   unsigned long *buffer;/* Buffer containing image from current view  */
  102.   double bank;        /* Bank angle (relative to up)                */
  103. } AbsMovement;
  104.  
  105. /* Movement movement status */
  106. typedef struct {        
  107.   iVector om, m;        /* Old, current mouse (x,y) position in window */
  108. } MouseMovement;
  109.  
  110. typedef struct {
  111.   iVector om, m;    /* old and new mouse positions in (x,y)       */
  112.   double rot[3];        /* View rotation amount                       */
  113.   double transl[3];     /* View translation amount                    */
  114. /*  Matrix viewmat; */  /* View transformation                        */
  115. } RelMovement;          /* Keep track of eye movement                 */
  116.  
  117. typedef struct movement{/* Movement = relative or absolute movement   */
  118.   char mtype;           /* Movement type                              */
  119.   AbsMovement *amove;
  120.   RelMovement *rmove;
  121.   struct movement *next;
  122. } Movement;
  123.  
  124. /**********************************************************************/
  125. /* kernal stuff for Abuffering (not used)                             */
  126. /**********************************************************************/
  127. #define MAXSAMPLES  64
  128.  
  129. /* A sample is x,y fractional offsets from pixel center and a weight. */
  130. typedef struct {
  131.     float x, y, weight;
  132. } SAMPLE;
  133.  
  134. /* A kernel is an array of samples */
  135. typedef struct {
  136.     int numsamples;
  137.     SAMPLE samples[MAXSAMPLES];
  138. } KERNEL;
  139.  
  140. /**********************************************************************/
  141. #define MAX_ENTRIES 10   /* Maximum menu entries */
  142.  
  143. /**********************************************************************/
  144. /* Function prototypes and externs */
  145. /**********************************************************************/
  146. extern SystemAttrib System;
  147. extern OptionType Option;
  148. extern Matrix objmat;
  149. extern Matrix Identity;
  150. extern AbsMovement Viewer;
  151. extern RelMovement view; 
  152. extern MouseMovement Mouse;
  153. extern int moves_logged;
  154. extern FILE *movefile;
  155. extern char *movefilename;
  156. extern Movement *Autoview;
  157. extern Movement *Mtail;
  158. extern FILE *scenefile;  
  159. extern int KernelId;
  160. extern char **Kernels;
  161. extern int NumKernels;
  162. extern char *KernelFile;
  163. extern char *ProgName;
  164. extern char *WindowName;
  165. extern long WindWid; 
  166. extern long WindXorigin, WindYorigin;
  167. extern long WindXsize, WindYsize;
  168. extern long PanelWid;
  169. extern long HelpWid;
  170. extern char *HelpCmd;
  171. extern long Menu;
  172. extern fmfonthandle FontScreen, FontScreen5, FontScreen8, FontScreen10;
  173. extern fmfontinfo FontScreenInfo, FontScreen5Info, 
  174.   FontScreen8Info, FontScreen10Info;
  175. extern void CopyViewer();
  176. extern void CopyViewChg();
  177.  
  178. #endif /* WALK_H */
  179.